package my.jwds.p806;

public class NumberOfLines {

    public static void main(String[] args) {

        Solution obj = new Solution();
        long start = System.currentTimeMillis();
        System.out.println("运行时间:" + (System.currentTimeMillis() - start));
    }

    static class Solution {

        public int[] numberOfLines(int[] widths, String ss) {
            int [] res = {1,0};
            for (char c : ss.toCharArray()) {
                int capacity = widths[c-'a'];
                if (capacity+res[1] > 100 ){
                    res[0]++;
                    res[1] = capacity;
                }else{
                    res[1] += capacity;
                }
            }
            return res;
        }

    }
}